# 记录获取数据的信息
from mongo.MongoHelper import MongoHelper
from tools.conf.confU import confU

conf = confU().config


class DataLog:
    mongoHelper = None

    def __init__(self):
        self.mongoHelper = MongoHelper(url=conf.get('db', 'url'), database=conf.get('db', 'database'))
        pass

    @staticmethod
    def add_log(record):
        # 数据名称, 数据周期， 数据来源， 找到多少，更新多少， 插入多少， 忽略多少，更新日期
        coll = DataLog().mongoHelper.mongo_db.get_collection('dataLog')
        if coll is not None:
            coll.insert_one(record)
